﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyNet.Componets.Core.Mapper
{
    public interface IMapper
    {
        /// <summary>
        /// Adapt a source object to an instance of type <paramref>
        ///                                                <name>TTarget</name>
        ///                                              </paramref>
        /// </summary>
        /// <typeparam name="TSource">Type of source item</typeparam>
        /// <typeparam name="TTarget">Type of target item</typeparam>
        /// <param name="source">Instance to adapt</param>
        /// <returns><paramref name="source"/> mapped to <typeparamref name="TTarget"/></returns>
        TTarget Map<TSource, TTarget>(TSource source)
            where TTarget : class, new()
            where TSource : class;


        /// <summary>
        /// 映射转换
        /// </summary>
        /// <typeparam name="TSource">源对象类型</typeparam>
        /// <typeparam name="TTarget">目标对象类型</typeparam>
        /// <param name="source">源对象</param>
        /// <param name="target">目标对象</param>
        /// <returns></returns>
        TTarget Map<TSource, TTarget>(TSource source, TTarget target)
           where TTarget : class, new()
           where TSource : class;

    }
}
